package BasicClass.One;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class BasicOne17 {
    public static void main(String[] args) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        int size = Integer.parseInt(bufferedReader.readLine());
        String[] split = bufferedReader.readLine().split(" ");
        int[] arr = new int[size];
        for (int i = 0; i < size; i++) {
            arr[i] = Integer.parseInt(split[i]);
        }
        BasicOne17 one17 = new BasicOne17();
        int i = one17.Main(arr, 0, size - 1);
        System.out.println(i);
    }

    /**
     * 用递归方法找一个数组中的最大值
     */
    public int Main(int[] arr,int left,int right){
        if(left==right){
            return arr[left];
        }
        int mid = left+((right-left)>>1);
        int lValue = Main(arr,left,mid);
        int rValue = Main(arr,mid+1,right);
        return Math.max(lValue,rValue);
    }
}
